<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
    <meta charset="UTF-8" />
    <title>Insert title here</title>
</head>
<body>
<h1 th:inlines="text">文件上传</h1>
<form id="uploadForm">
    <p>选择文件: <input type="file" name="fileName"/></p>
    <input type="button" value="上传" onclick="doUpload1()" />
</form>
<script src="../static/js/jquery.min.js"></script>
<script src="../static/js/bootstrap.min.js"></script>
<script src="../static/js/user.js"></script>
<script src="../static/js/user/userClient.js"></script>
<script>
    function doUpload1() {
        var formData = new FormData($( "#uploadForm" )[0]);
        $.ajax({
            type: 'POST',
            url: '../file/upload' ,
            data: formData,
            async: false,
            cache: false,
            contentType: false,
            processData: false,
            success: function (returndata) {
                alert("上传成功");
            },
            error: function (returndata) {
                alert("上传失败");
            }
        });
    }

</script>

</body>
</html>